//
//  MZDayPickerCell.m
//  MZDayPicker
//
//  Created by Michał Zaborowski on 18.04.2013.
//  Copyright (c) 2013 whitecode. All rights reserved.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.

#import "MZDayPickerCell.h"

@interface MZDayPickerCell ()

@end

@implementation MZDayPickerCell

- (void)setCountStr:(NSString *)countStr
{
    [self applyCellStyle:countStr];
}

- (void)applyCellStyle:(NSString *)str
{

    [self.containerView removeFromSuperview];
//    self.containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth/5, self.height)];
    
    self.dayLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
    self.dayLabel.text = str;
    self.dayLabel.center = CGPointMake(_containerView.frame.size.width/2, self.height/2.8);
    self.dayLabel.textAlignment = NSTextAlignmentCenter;
    self.dayLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:28.0];
    self.dayLabel.backgroundColor = [UIColor clearColor];
    
    self.dayNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
    self.dayNameLabel.text = @"章";
    self.dayNameLabel.center = CGPointMake(_containerView.frame.size.width/2, self.height/1.5);
    self.dayNameLabel.textAlignment = NSTextAlignmentCenter;
    self.dayNameLabel.font = [UIFont fontWithName:@"HelveticaNeue-Medium" size:14.0];
    self.dayNameLabel.backgroundColor = [UIColor clearColor];
    
    [_allView addSubview: self.dayLabel];
    [_allView addSubview: self.dayNameLabel];
    
    [_containerView setTransform:CGAffineTransformMakeRotation(M_PI_2)];
    [self addSubview:_containerView];
    if (self.width != self.height) {
//        _containerView.frame = CGRectMake(0, 0, 100, ScreenWidth/5);
    }
}


@end
